package Long.Lu.Dao;


import Long.Lu.pojo.Contract;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
public interface ContractDao extends JpaRepository<Contract, Integer> {

    @Transactional  //提交事务  执行增删改需要的
    @Modifying(clearAutomatically = true)  //表示执行增删改CRU操作的时候，清楚实体类的数据
    @Query(value = "delete from contract where contract_id=:contractId",nativeQuery = true)
    void deleteContractByContractId(@Param("contractId") Integer contractId);
}
